package com.utility.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
import com.utility.project.common.base.R;
import com.utility.project.param.ExamParam;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import javax.annotation.Resource;
import com.utility.project.service.IYsExamService;
import com.utility.project.entity.YsExam;

import java.util.List;

/**
 * @author yangzhiguo
 * @date 2024-06-22
 * @description 试题
 */
@Api(tags = "试题")
@RestController
@RequestMapping("/ysExam")
public class YsExamController {

    @Resource
    private IYsExamService ysExamService;

    @ApiOperation("通过ID查询试题数据")
    @GetMapping("/queryById")
    public R queryById(@RequestParam("id")Long id){
        return R.ok(ysExamService.getById(id));
    }

    @ApiOperation("根据试题id查询口语和写作试题列表")
    @PostMapping("/queryExamByPaperId")
    public R queryExamByPaperId(@RequestBody ExamParam examParam ){
        IPage<YsExam> paperDtoList = ysExamService.queryExamByParam(examParam);
        return R.ok(paperDtoList);
    }
    
}
